package tv.acgn.advertisement.search.index;

import tv.acgn.advertisement.search.exception.AbstractAdSearchException;

/**
 * @author : junG
 * @program : advertisement-ad-search-index
 * @description : 索引操作接口
 * @date : 2019-06-30 22:17
 **/

public interface IndexAware<Key, Value> {

    /**
     * <h2>通过索引的键获取值</h2>
     * @author junG
     * @description 通过索引的键获取值
     * @date 22:31 2019/6/30
     * @param key [1] 键
     * @return {@link Value} 值对象
     * @throws  AbstractAdSearchException 异常
     */
    Value get(Key key)throws AbstractAdSearchException;

    /**
     * <h2>新增一条索引</h2>
     * @author junG
     * @description 新增一条索引
     * @date 22:32 2019/6/30
     * @param key [1] 键
     * @param value [2] 值对象
     * @return {@link Void}
     * @throws  AbstractAdSearchException 异常
     */
    void add(Key key, Value value)throws AbstractAdSearchException;

    /**
     * <h2>更新索引键对应的索引值对象</h2>
     * @author junG
     * @description 更新索引键对应的索引值对象
     * @date 22:35 2019/6/30
     * @param key [1]
     * @param value [2]
     * @return {@link Void}
     * @throws AbstractAdSearchException 异常
     */
    void update(Key key, Value value)throws AbstractAdSearchException;
    
    /**
     * <h2>删除索引对象</h2>
     * @author junG
     * @description 删除索引对象
     * @date 22:26 2019/6/30
     * @param key [1]
     * @return {@link Void}
     * @throws  AbstractAdSearchException 异常
     */
    void delete(Key key)throws AbstractAdSearchException;
}
